﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ZHDJ.Mobile.Models;

namespace ZHDJ.Mobile.Controllers
{
    public class IndexController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Content()
        {
            return View();
        }

        public ActionResult Login()
        {
            return View();
        }

        public ActionResult PersonCenter()
        {
            return View();
        }

        public ActionResult Search()
        {
            return View();
        }

        /// <summary>
        /// 随手拍列表页面
        /// </summary>
        /// <returns></returns>
        public ActionResult SuiShouPai()
        {
            return View();
        }

        /// <summary>
        /// 随手拍表单页面
        /// </summary>
        /// <returns></returns>
        public ActionResult SuiShouPaiEdit()
        {
            return View();
        }

        /// <summary>
        /// 群众心声
        /// </summary>
        /// <returns></returns>
        public ActionResult MassesVoice()
        {
            return View();
        }

        /// <summary>
        /// 留言板
        /// </summary>
        /// <returns></returns>
        public ActionResult MessageBoard()
        {
            return View();
        }

        public ActionResult Error()
        {
            return View();
        }

        //存储Session
        public ReturnResult SetSession(PartyBuildingUser model)
        {
            //写入Session
            Session["SESSION_ADMIN_INFO"] = model;
            Session.Timeout = 45;

            return new ReturnResult()
            {
                code = "200",
                msg = "success"
            };
        }

        //获取Session
        public JsonResult GetSession()
        {
            ReturnResult result = new ReturnResult();
            PartyBuildingUser model = new PartyBuildingUser();
            if (Session["SESSION_ADMIN_INFO"] != null)
            {
                model = Session["SESSION_ADMIN_INFO"] as PartyBuildingUser;
            }

            if (string.IsNullOrWhiteSpace(model.UserId))
            {
                result.code = "201";
                result.msg = "请您先登录！";
            }
            else
            {
                result.code = "200";
                result.result = model;
                result.msg = "success";
            }

            return Json(result);
        }

        public ActionResult UpLogo()
        {
            return View();
        }

        public ActionResult Menu()
        {
            return View();
        }

        public ActionResult Ceshi()
        {
            return View();
        }

    }
}